home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 12570 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.9 KB

  1. Path: news.ahc.ameritech.com!datalytics!usenet
  2. From: Rob Stewart <stew@datalytics.com>
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: HELP:: Naming Conventions
  5. Date: Wed, 20 Mar 1996 12:16:55 -0500
  6. Organization: Datalytics, Inc
  7. Message-ID: <31503D87.4D62@datalytics.com>
  8. References: <4in6gn$p2t@info.eng.octel.com> <4io6n5$n9v@sam.inforamp.net>
  9. NNTP-Posting-Host: 204.62.224.71
  10. Mime-Version: 1.0
  11. Content-Type: text/plain; charset=us-ascii
  12. Content-Transfer-Encoding: 7bit
  13. X-Mailer: Mozilla 2.0 (WinNT; I)
  14.  
  15. Randy Charles Morin wrote:
  16. > In article <4in6gn$p2t@info.eng.octel.com>, wdengel@ibm.net (Wayne) wrote:
  17. > >class MyObject
  18. > >..
  19. > >MyObject m_MyInstance;         OK
  20. > >MyObject *pm_MyInstance;       OK
  21. > >but what about
  22. > >MyObject *???_MyInstance[SomeNum]      What is the convention???
  23. > MyObject am_MyInstance;
  24. > or...
  25. > MyObject m_aMyInstance;
  26. > I've always used a to denote an array.
  27. > Agrivar
  28.  
  29. We use "v" to denote vector.  This is a more general term and 
  30. applies equally well to user-defined vector types (classes).
  31.  
  32. I assume the "m_" in your examples denotes data members?  If 
  33. that's the case, may I recommend that the "m_" always start the 
  34. identifier?  In other words, your "pm_MyInstance" should be 
  35. "m_pMyInstance."  This keeps the usage prefix ("p" in this case) 
  36. with the identifier as it would be for non-members 
  37. ("pAnInstance") and ensures that the "m_" is visible.
  38.  
  39. We don't subscribe to the whole Hungarian notation mess, 
  40. however.  We only use the following usage prefixes:
  41.  
  42.     b    boolean value (the type may int, bool, etc.)
  43.     p    pointer to something
  44.     h    handle to something (this may be UNIX's int file
  45.         handle, Win32's HANDLE, etc.)
  46.     v    vector (array) of something
  47.  
  48. I do make use of certain other more complex type prefixes as 
  49. shown here:
  50.  
  51.     cs    critical section (a Win32 thread synchronization
  52.         construct)
  53.     mtx    mutex
  54.     sem    semaphore
  55.  
  56. -- 
  57. Robert Stewart        | My opinions are usually my own.
  58. Datalytics, Inc.    | stew@datalytics.com
  59.